<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8"/>
    <title>登录</title>
    <link rel="stylesheet" href="/static/css/login.css" type="text/css"/>
</head>
<body>
<div class="login">
    <!-- <div class="logo">
         <a href="/">
             <img src="/static/img/login.png" width="212" height="109">
         </a>
     </div>-->
    <div class="main">
        <h4 class="title">
            <div class="normal_title">
                <a class="active" href="/user/login">登录</a>
                <b>·</b>
                <a class="sign_up" href="/user/register">注册</a>
            </div>
        </h4>
        <div class="input_content">
            <!--action="/user/loginCheck"-->
            <form id="new_session" accept-charset="UTF-8" method="get">
                <div class="input_user">
                    <input placeholder="手机号或邮箱" type="text" name="mobile_email" id="mobile_email">
                    <i class="icon_user"></i>
                </div>
                <div class="input_pwd">
                    <input placeholder="密码" type="password" name="user_pwd" id="user_pwd">
                    <i class="icon_pwd"></i>
                </div>
                <div class="remember_btn">
                    <input type="checkbox" value="true" checked="checked" name="remember_me" id="remember_me">
                    <span>记住密码</span>
                </div>
                <div class="forget_pwd">
                    <a href="#">忘记密码？</a>
                </div>
                <input type="submit" name="commit" value="登录" class="login_btn" onclick="loginCheck()">
            </form>
        </div>
    </div>
</div>
<script type="text/javascript">
    function loginCheck() {
        var xmlhttp;
        if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
            xmlhttp = new XMLHttpRequest();
        }
        else {// code for IE6, IE5
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.onreadystatechange = function () {
            if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                var json = JSON.parse(xmlhttp.responseText);
                if (json.c != 0) {
                    alert(json.m)
                } else {
                    //注册成功页面跳转，
                    window.location.href = "/user/register";
                }
            }
        }
        xmlhttp.open("GET", "/user/loginCheck", true);
        xmlhttp.send();
    }

    function login() {
        $.post("/user/loginCheck", {account: "1111", psw: "1234"},
            function (data) {
                var json = JSON.parse(data);
                if (json.c != 0) {
                    alert(json.m)
                } else {
                    //注册成功页面跳转，
                    window.location.href = "/user/register";
                }
            }, "json");
    }

</script>
</body>
</html>